<?php $this->headScript()->appendFile($this->publicUrl . "/Scripts/confirmAction.js"); ?>

<h2><?= $this->translate("CategoriesList") ?></h2>

<table>
  <tr>
    <th><?= $this->translate("Id") ?></th>
    <th><?= $this->translate("Name") ?></th>
  </tr>
	<?php foreach ($this->categories as $category) { ?>
	  <tr>
		<td>
			<?= $category->id ?>
		</td>
		<td>
			<?= $this->escape($category->translate("name")) ?>
		</td>
		<td>
			<a href="<?= $this->url(array("action"=>"edit-category","controller"=>"categories","id"=>$category->id)) ?>" title="<?= $this->translate("Edit") ?>">
				<?= $this->translate("Edit") ?>
			</a>
		</td>
		<td>
			<a onclick="confirmAction('<?= $this->translate('sureDeleteCategory') ?>',
				'<?= $this->url(array("action"=>"remove-category","controller"=>"categories","id"=>$category->id)) ?>'); return false;"
				href="#" title="<?= $this->translate("Delete") ?>">
				<?= $this->translate("Delete") ?>
			</a>
		</td>
	 </tr>
	<?php } ?>  
</table>
<?= $this->paginationControl($this->categories, 'Sliding', 'paginatorControl.phtml') ?>
<a href="<?= $this->url(array("action"=>"add-category","controller"=>"categories")) ?>" title="<?= $this->translate("AddNew") ?>">
	<?= $this->translate("AddNew") ?>
</a>
